#!/usr/bin/env python

#    Copyright 2011,2012 Erik Persson
#
#    This file is part of the cell-sync-usrp project.
#
#    cell-sync-usrp is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    cell-sync-usrp is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with cell-sync-usrp.  If not, see <http://www.gnu.org/licenses/>.


import decodedSeq


for a in decodedSeq.decodedSeq:
    pos = 0
    data = []
    while (pos<len(a)):
        if (pos%8==0):
            #first bit in byte
            b = 0
        
        b += 2**(7-(pos%8)) * a[pos]
        
        if (pos % 8 == 7):
            # last bit in byte
            data.append(b)
        pos += 1
    if (pos%8 != 7):
        data.append(b)
    
    print "BCCH: ",
    for d in data:
        print "%0x" % d,
    print " "
        
        
